<template>
  <view class="content1 ba_img1" :style="isShowYe == true ? '' : y_bj">
    <view
      :style="{
        color: 'rgb(173, 173, 173)',
        'text-align': 'center',
        padding: '40rpx 30rpx 0 30rpx',
      }"
      v-if="toNum == 0"
      >{{ anTitle }}</view
    >
    <!-- 头部 -->
    <view class="header" :style="{}" v-if="hasHead">
      <view class="head_left" @click="goBnak">
        <u-icon size="20" name="arrow-left" color="#EEEEEE"></u-icon>
      </view>
      <view class="jiahao">
        <image src="../../static/images/slices/icon_zhunfa.png" mode=""></image>
      </view>
    </view>

    <!-- 用户信心 -->
    <view class="user_detail" :style="isShowYe == true ? '' : y_margin">
      <view class="user_img">
        <view class="user_img_left">
          <image :src="user.avatar_url" mode=""></image>
        </view>
        <view
          class="user_img_right"
          v-show="!type && !is_guanzhu"
          @click="subRegard"
        >
          <view>
            <u-icon size="17" name="plus" color="#EEEEEE"></u-icon>
          </view>
          <view class="btn_text">关注</view>
        </view>
        <view
          class="user_img_right_false"
          v-show="!type && is_guanzhu"
          @click="subRegard"
        >
          <view class="btn_text_false">已关注</view>
        </view>
        <view class="user_img_right_border" v-show="type">
          <view>
            <u-icon size="17" name="edit-pen" color="#EEEEEE"></u-icon>
          </view>
          <view class="btn_text" @click="edit">编辑</view>
        </view>
      </view>
      <view class="user_name">
        <view class="user_name_left">
          <view class="userName">
            {{ user.nick_name }}
          </view>
          <view class="userGrade" v-if="user.grade">
            {{ user.grade.level_name }}
          </view>
        </view>
        <view class="user_name_right">
          <view class="user_data" @click="goInteraction">
            <view class="user_data_top">{{ user.guanzhu }}</view>
            <view class="user_data_bot">关注</view>
          </view>
          <view class="user_seg"></view>
          <view class="user_data" @click="goInteraction">
            <view class="user_data_top">{{ user.beiguanzhu }}</view>
            <view class="user_data_bot">被关注</view>
          </view>
          <view class="user_seg"></view>
          <view class="user_data">
            <view class="user_data_top">{{ user.like_count }}</view>
            <view class="user_data_bot">获赞</view>
          </view>
        </view>
      </view>
      <view class="user_member" v-if="user.Namealias">
        山海名号：{{ user.Namealias.length == 0 ? "暂无" : "" }}
        <view v-for="(shanItem, shanInd) in user.Namealias" :key="shanInd"
          >{{ shanItem.name
          }}{{ shanInd == user.Namealias.length - 1 ? "" : "-" }}</view
        >
      </view>
      <view class="user_text">
        {{ user.introduce }}
      </view>
    </view>

    <!-- 导航栏 -->
    <view class="tab_view">
      <u-tabs
        lineWidth="32"
        lineColor="#EEEEEE"
        :activeStyle="{
          color: '#EEEEEE',
          width: '64rpx',
          height: '48rpx',
          'line-height': '48rpx',
          'text-align': 'center',
          'font-size': '32rpx',
        }"
        :inactiveStyle="{
          color: '#ADADAD',
          width: '64rpx',
          height: '48rpx',
          'line-height': '48rpx',
          'text-align': 'center',
        }"
        item-width="166"
        :list="is_teacher == 0 && is_senators == 0 ? list : list2"
        :scrollable="false"
        :current="current"
        @change="changeList"
      ></u-tabs>
    </view>

    <scroll-view
      :style="{
        height: toNum == 1 ? scrollHeihgt + 'px' : 'auto',
      }"
      :scroll-y="toNum == 1 ? true : false"
      @scroll="scroll"
      @scrolltolower="scrolltolower"
    >
      <view class="chooseItem" :class="hasHead ? '' : 'chooseItem2'">
        <!-- 作品 -->
        <view
          v-if="
            selected == 'zuopin' &&
            (user.is_teacher == 1 || user.is_senators == 1)
          "
          class="list_home"
        >
          <homeMod
            v-if="zuopinObj.kechengList"
            :list="zuopinObj.kechengList.data"
            title="课程"
            type="text"
          ></homeMod>
          <homeMod
            v-if="zuopinObj.tushuList"
            :list="zuopinObj.tushuList.data"
            title="图书"
            type="bimg"
          ></homeMod>
        </view>
        <!-- 微创 -->
        <view v-if="selected == 'weichuang'" class="list_item">
          <view class="chooseIndex">
            <!-- <view
            class="chooseIndex"
            :style="{
              background: isHeadBack ? 'rgba(0,0,0,0.3)' : 'rgba(0,0,0,0)',
            }"
          > -->
            <u-tabs
              :list="list4"
              lineWidth="0"
              lineColor="#f56c6c"
              :activeStyle="{
                color: '#EEEEEE',
                width: '144rpx',
                height: '56rpx',
                'line-height': '56rpx',
                'text-align': 'center',
                background: 'rgba(39,39,39,0.5)',
                'border-radius': '32rpx 32rpx 32rpx 32rpx',
                'font-size': '28rpx',
              }"
              :inactiveStyle="{
                width: '144rpx',
                height: '56rpx',
                'line-height': '56rpx',
                'text-align': 'center',
                background: 'rgba(39,39,39,0.5)',
                'border-radius': '32rpx 32rpx 32rpx 32rpx',
                color: '#ADADAD',
                'font-size': '28rpx',
              }"
              itemStyle="padding:0 20rpx; height: 56rpx'width: 144rpx"
              @change="change"
            >
            </u-tabs>
          </view>
          <!-- 星云共创 -->
          <view v-show="currentIndex == 0" class="gongchuang_box">
            <!-- <starList :isWhite="true" :list="xingList" :type="type"></starList> -->
            <view
              v-for="(item, ind) in xingList.data"
              :key="ind"
              @click="goPage(item)"
              :style="{ marginTop: '20rpx' }"
            >
              <view class="item_box">
                <view>{{ item.keywords }}</view>
                的星云共创
              </view>
              <u-divider></u-divider>
            </view>
            <view
              class="empty_view"
              v-if="xingList.data && xingList.data.length == 0"
            >
              <image
                class="item_left_clickable"
                src="../../static/images/my/kong.png"
                mode=""
              ></image>
              <view>当前没有相关数据，请查看其他分类或功能。</view>
            </view>
            <view style="height: 60rpx"></view>
          </view>
          <!-- 诗心园 -->
          <view v-show="currentIndex == 1">
            <poem
              :isShow="false"
              :showName="false"
              :list="shiList.data"
              :displayMode="type ? true : false"
              :type="type"
              :my_level_id="my_level_id"
            ></poem>
            <view style="height: 60rpx"></view>
          </view>
          <!-- 游记 -->
          <view v-show="currentIndex == 2">
            <youji
              :isShow="false"
              :showName="false"
              :list="youList.data"
              :displayMode="type ? true : false"
              :type="type"
              :my_level_id="my_level_id"
            ></youji>
            <view style="height: 60rpx"></view>
          </view>
          <!-- 飞离洞 -->
          <view v-show="currentIndex == 3">
            <commentBlock
              :list="feiList.data"
              :displayMode="type ? true : false"
              :type="type"
              :my_level_id="my_level_id"
            ></commentBlock>
            <view style="height: 60rpx"></view>
          </view>
          <!-- 灵感塔 -->
          <view v-show="currentIndex == 4">
            <!-- <lingDongT></lingDongT> -->
            <lingDD
              :list="lingList.data"
              :type="type"
              :my_level_id="my_level_id"
            ></lingDD>
            <view style="height: 60rpx"></view>
          </view>

          <!-- 文心岛 -->
          <view v-show="currentIndex == 5">
            <wenIsland
              :isShow="false"
              :currentIndex="3"
              :familyList="wenList"
              :displayMode="type ? true : false"
              :type="type"
              :my_level_id="my_level_id"
            ></wenIsland>
            <view style="height: 60rpx"></view>
          </view>
        </view>
        <!-- 家园 -->
        <view v-if="selected == 'jiayuan'" class="list_home">
          <view>
            <homeMod
              :list="jiayuanList.family"
              title="我的家族"
              type="text"
              :isFamily="true"
              v-if="jiayuanList.family && jiayuanList.family.length > 0"
            ></homeMod>
            <view class="nolist_box" v-else @click="myRecord">
              <view>我的家族</view>
              <u-icon size="17" name="arrow-right" color="#EEEEEE"></u-icon>
            </view>
          </view>
          <view>
            <homeMod
              :list="jiayuanList.home"
              title="我的家乡"
              type="text"
              :isFamily="true"
              v-if="jiayuanList.home && jiayuanList.home.length > 0"
            ></homeMod>
            <view class="nolist_box" v-else @click="myRecord">
              <view>我的家乡</view>
              <u-icon size="17" name="arrow-right" color="#EEEEEE"></u-icon>
            </view>
          </view>
          <view>
            <homeMod
              :list="jiayuanList.youli"
              title="我的游历"
              type="text"
              v-if="jiayuanList.youli && jiayuanList.youli.length > 0"
            ></homeMod>
            <view class="nolist_box" v-else @click="promptFn">
              <view>我的游历</view>
              <u-icon size="17" name="arrow-right" color="#EEEEEE"></u-icon>
            </view>
          </view>

          <homeMod
            :list="jiayuanList.futian"
            title="我的福田"
            type="simg"
          ></homeMod>
          <homeMod
            :list="jiayuanList.yanxiu"
            title="我的研修"
            type="text"
            v-if="jiayuanList.yanxiu"
          ></homeMod>
          <homeMod
            :list="jiayuanList.xunlian"
            title="训练营"
            type="text"
          ></homeMod>
          <view style="height:40rpx"></view>
        </view>
        <!-- 相册 -->
        <view v-if="selected == 'xiangce'">
          <album
            :list="xiangceList.data"
            v-if="xiangceList.data"
            @updateDataXiangce="updateDataXiangce"
            :type="type"
          ></album>
        </view>
        <!-- 评论 -->
        <view v-if="selected == 'pinglun'">
          <discuss :list="pinglunList.data"></discuss>
        </view>
      </view>
    </scroll-view>
    <floatingBall></floatingBall>
  </view>
</template>

<script>
import commentBlock from "@/components/commentBlock.vue"; // 飞离洞
import lingDongT from "@/components/lingDongT.vue";
import wenIsland from "@/components/wenIsland.vue"; // 文心岛
import lingDD from "@/components/lingDD.vue"; // 灵感塔
import nebula from "@/components/nebula.vue";
import poem from "@/components/poem.vue"; // 诗心园
import youji from "@/components/youji.vue"; // 游记
import homeMod from "@/components/homeMod.vue";
import album from "@/components/album.vue";
import discuss from "@/components/discuss.vue";
import starList from "@/components/starList.vue";
import storage from "@/common/storage"; // 缓存封装
export default {
  components: {
    commentBlock,
    lingDD,
    wenIsland,
    nebula,
    poem,
    lingDongT,
    homeMod,
    album,
    discuss,
    starList,
    youji,
  },
  props: {
    hasHead: {
      type: Boolean,
      default: true,
    },
    toNum: {
      type: Number,
      default: 1, // 0冰释引   1个人主页
    },
    // zuopinObj: {
    //   type: Object,
    //   default: () => {
    //     return {};
    //   },
    // },
    isShowYe: {
      type: Boolean,
      default: false,
    },
  },

  data() {
    return {
      isRegard: false, // true已关注  false没关注
      statusBarHeight: 0,
      scrollHeihgt: 0,
      height: 0,
      windowHeihgt: 0,
      list4: [
        {
          name: "星云共创",
        },
        {
          name: "诗心园",
        },
        {
          name: "游记",
        },
        {
          name: "飞离洞",
        },
        {
          name: "灵感塔",
        },

        {
          name: "文心岛",
        },
      ],
      list: [
        {
          name: "微创",
          str: "weichuang",
        },
        {
          name: "家园",
          str: "jiayuan",
        },
        {
          name: "相册",
          str: "xiangce",
        },
        {
          name: "评论",
          str: "pinglun",
        },
      ],
      list2: [
        {
          name: "作品",
          str: "zuopin",
        },
        {
          name: "微创",
          str: "weichuang",
        },
        {
          name: "家园",
          str: "jiayuan",
        },
        {
          name: "相册",
          str: "xiangce",
        },
        {
          name: "评论",
          str: "pinglun",
        },
      ],

      current: 0,
      isHeadBack: false,
      listIndex: 0,
      selected: "zuopin", // zuopin weichuang jiayuan xiangce pinglun
      currentIndex: 0,
      userImg: "../../static/images/pic_sy_jinrigengxin.png",
      show: false,
      is_guanzhu: 0, //未关注 1已关注
      user: {}, // 用户信息
      jiayuanList: {},
      xiangceList: {},
      pinglunList: {},
      feiList: {},
      shiList: {},
      wenList: {},
      xingList: {},
      lingList: {},
      youList: {},
      zuopinObj: {},
      user_id: 1,
      type: "",
      y_bj: {
        backgroundImage: "url(" + require("@/static/images/index.png") + ")",
        position: "fixed",
        width: "100vw",
        height: "100vh",
      },
      y_margin: {
        marginTop: "180rpx",
      },
      page: 1,
      last_page: 0,
      selectName: "微创",
      is_teacher: 0,
      is_senators: 0,
      anTitle: "", // 山海暗文标题
      my_level_id: 0,
    };
  },
  onLoad(options) {
    // console.log(this.user_id, 5555555555555555);

    this.type = options.type;
    if (options.user_id) {
      this.user_id = options.user_id;
    } else {
      this.user_id = 1;
    }
  },
  created() {},
  onShow: function () {
    this.page = 1;
    this.last_page = 0;
    this.$forceUpdate();
    this.$nextTick(() => {
      uni
        .createSelectorQuery()
        .select(".head")
        .boundingClientRect((data) => {
          this.height = data.height;
        })
        .exec();
    });
    this.getZhuye(false);
    // this.getFei();
    // console.log(this.selectName);
    if (this.selectName == "微创") {
      if (this.currentIndex == 0) {
        this.getXing();
      } else if (this.currentIndex == 1) {
        this.getShi();
      } else if (this.currentIndex == 2) {
        this.getYouji();
      } else if (this.currentIndex == 3) {
        this.getFei();
      } else if (this.currentIndex == 4) {
        this.getLing();
      } else if (this.currentIndex == 5) {
        this.getWen();
      }
    } else if (this.selectName == "家园") {
    } else if (this.selectName == "相册") {
      this.getXiangCe("");
    } else if (this.selectName == "评论") {
      this.getPingLun();
    }

    // this.getWeiChuang();
    // this.getJiaYuan();
    // this.getXiangCe("");
    // this.getPingLun();
  },
  mounted() {
    // if (this.toNum == 0) {
    //   this.selected = "zuopin";
    // } else {
    //   this.selected = "weichuang";
    // }
    // console.log(this.user_id, 666666666);
    // console.log(storage.get('shanAn'),'山海暗文')
    this.anTitle = storage.get("shanAn").bingshiyin;
    this.getZhuye(true);
    // this.getFei();
    this.getXing();
    // this.getWeiChuang();
    // this.getJiaYuan();
    // this.getXiangCe("");
    // this.getPingLun();
  },
  methods: {
    goPage(item) {
      uni.navigateTo({
        url: `/pages/home/personCoCreate?name=${item.keywords}&zid=${item.zhangjie_id}&id=${item.citiao_id}`,
      });
      // pages/home/personCoCreate?name=内蕴&zid=26&id=36
    },
    promptFn() {
      uni.$u.toast("他还没有创作哦~");
    },
    // 获取各种高度
    getHeight() {
      const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度
      // this.statusBarHeight = statusBarHeight.statusBarHeight ;
      this.windowHeihgt =
        statusBarHeight.windowHeight - statusBarHeight.statusBarHeight;
      // console.log(statusBarHeight.windowHeight, "总高度");
      // console.log(statusBarHeight.statusBarHeight, "不知道什么高度");
      this.$nextTick(() => {
        const query = uni.createSelectorQuery().in(this);
        query.select(".header").fields({
          size: true,
        });
        query.select(".user_detail").fields({
          size: true,
        });
        query.select(".tab_view").fields({
          size: true,
        });

        query.exec((data) => {
          // console.log(data, "各种高度");
          let sum = 0;
          data.forEach((item) => {
            if (item != null) {
              sum += item.height;
            }
          });
          this.scrollHeihgt = this.windowHeihgt - sum;
          // this.height = sum + 20;
          // console.log(data,'这个是啥')
        });
      });
    },
    // 返回上一页
    goBnak() {
      uni.navigateBack({
        delta: 1,
      });
    },
    // 关注按钮
    subRegard() {
      this.$http
        .userGuanzhu({ user_id: this.user_id || 1 })
        .then((res) => {
          uni.$u.toast(res.message);
          this.is_guanzhu = !this.is_guanzhu;
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    goInteraction() {
      if (this.type == "my") {
        uni.navigateTo({
          url: `/pages/detail/interaction?user_id=${this.user_id}`,
        });
      }
    },
    edit() {
      uni.navigateTo({
        url: `/pages/detail/edit?user_id=${this.user_id}`,
      });
    },
    // 顶部切换
    changeList(e) {
      this.page = 1;
      this.last_page = 0;
      // console.log("aaaaaaa", e);
      this.listIndex = e.index;
      this.selected = e.str;
      this.selectName = e.name;
      if (e.name == "微创") {
        // this.getFei();
        this.getXing();
      } else if (e.name == "家园") {
        this.getJiaYuan();
      } else if (e.name == "相册") {
        this.getXiangCe("");
      } else if (e.name == "评论") {
        this.getPingLun();
      }
    },
    // 微创切换
    change(e) {
      this.page = 1;
      this.last_page = 0;
      // console.log("eeeeeee", e);
      this.currentIndex = e.index;
      if (e.index == 0) {
        this.getXing();
      } else if (e.index == 1) {
        this.getShi();
      } else if (e.index == 2) {
        this.getYouji();
      } else if (e.index == 3) {
        this.getFei();
      } else if (e.index == 4) {
        this.getLing();
      } else if (e.index == 5) {
        this.getWen();
      }
    },
    scroll(e) {
      if (e.target.scrollTop == 0) {
        this.isHeadBack = false;
      } else {
        this.isHeadBack = true;
      }
    },

    scrolltolower() {
      if (this.page == this.last_page || this.last_page == 0) {
      } else {
        this.page++;
        // console.log(this.selectName,'当前tab名')
        if (this.selectName == "微创") {
          // this.currentIndex = e.index;
          if (this.currentIndex == 0) {
            this.getXing();
          } else if (this.currentIndex == 1) {
            this.getShi();
          } else if (this.currentIndex == 2) {
            this.getYouji();
          } else if (this.currentIndex == 3) {
            this.getFei();
          } else if (this.currentIndex == 4) {
            this.getLing();
          } else if (this.currentIndex == 5) {
            this.getWen();
          }
        } else if (this.selectName == "家园") {
          // this.getJiaYuan();
        } else if (this.selectName == "相册") {
          this.getXiangCe("");
        } else if (this.selectName == "评论") {
          this.getPingLun();
        }
      }
      // console.log("触发子组件");
    },
    // 获取作品
    getZuopin() {
      this.$http
        .userMyzuopin({ user_id: this.user_id, hideLoading: true })
        .then((res) => {
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].url = "/pages/training/detail";
          }
          this.zuopinObj = {
            kechengList: res.data.list,
            tushuList: res.data.list_tushu,
          };
          // console.log(this.zuopinObj, "冰释引-作品");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    // 查看用户主页
    getZhuye(bol) {
      // bol 首次进入true  再次进入false
      this.$http
        .userZhuye({ user_id: this.user_id })
        .then((res) => {
          let data = res.data.info;
          this.is_guanzhu = data.is_guanzhu;
          this.user = data.user;
          // console.log(this.user.is_teacher, "是不是老师");
          this.getHeight();
          this.is_teacher = this.user.is_teacher;
          this.is_senators = this.user.is_senators;
          if (bol) {
            if (this.user.is_teacher == 1 || this.user.is_senators == 1) {
              // 有作品tab
              this.getZuopin();
              this.selected = "zuopin";
            } else {
              // 没有作品tab
              this.selected = "weichuang";
            }
          }

          // console.log(data, "用户主页");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getFei() {
      // 飞离洞
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 1, page: this.page })
        .then((res) => {
          let data = res.data.list;
          this.my_level_id = res.data.my_level_id;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.feiList = res.data.list;
          } else {
            this.feiList.data = this.feiList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;

          // console.log(this.feiList, "飞离洞");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getLing() {
      // 灵感塔
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 2, page: this.page })
        .then((res) => {
          let data = res.data.list;
          this.my_level_id = res.data.my_level_id;
          // this.lingList = res.data.list;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.lingList = res.data.list;
          } else {
            this.lingList.data = this.lingList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;
          // console.log(data, "灵感塔");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getShi() {
      // 诗心园
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 3, page: this.page })
        .then((res) => {
          let data = res.data.list;
          this.my_level_id = res.data.my_level_id;
          // this.shiList = res.data.list;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.shiList = res.data.list;
          } else {
            this.shiList.data = this.shiList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;
          // this.user = data.user
          // console.log(data, "诗心园");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getWen() {
      // 文心岛
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 4, page: this.page })
        .then((res) => {
          let data = res.data.list;
          this.my_level_id = res.data.my_level_id;
          // this.wenList = res.data.list;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.wenList = res.data.list;
          } else {
            this.wenList.data = this.wenList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;
          // this.user = data.user
          // console.log(data, "文心岛");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getXing() {
      // 星云共创
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 5, page: this.page })
        .then((res) => {
          let data = res.data.list;
          // this.xingList = res.data.list;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.xingList = res.data.list;
          } else {
            this.xingList.data = this.xingList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;
          // this.user = data.user
          // console.log(this.xingList, "星云共创");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    getYouji() {
      // 游记
      this.$http
        .userWeichuang({ user_id: this.user_id, type: 6, page: this.page })
        .then((res) => {
          let data = res.data.list;
          this.my_level_id = res.data.my_level_id;
          // this.xingList = res.data.list;
          for (let i = 0; i < res.data.list.data.length; i++) {
            res.data.list.data[i].clickable = false;
          }
          if (res.data.list.current_page == 1) {
            this.youList = res.data.list;
          } else {
            this.youList.data = this.youList.data.concat(res.data.list.data);
          }
          this.last_page = res.data.list.last_page;
          // this.user = data.user
          // console.log(this.xingList, "星云共创");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },

    // 家园
    getJiaYuan() {
      this.$http
        .userJiayuan({ user_id: this.user_id })
        .then((res) => {
          let data = res.data;
          this.jiayuanList = res.data;
          // 我的家族添加路由
          for (let i = 0; i < this.jiayuanList.family.length; i++) {
            this.jiayuanList.family[i].url = "/pages/detail/myRecord";
            this.jiayuanList.family[i].from = "bingshiyin";
            if (this.type) {
              this.jiayuanList.family[i].type = "my";
            }
          }
          // 我的家乡添加路由
          for (let i = 0; i < this.jiayuanList.home.length; i++) {
            this.jiayuanList.home[i].url = "/pages/detail/myRecord";
            this.jiayuanList.home[i].from = "bingshiyin";
            if (this.type) {
              this.jiayuanList.home[i].type = "my";
            }
          }
          // 我的游历添加路由
          for (let i = 0; i < this.jiayuanList.youli.length; i++) {
            this.jiayuanList.youli[i].url = `/pages/detail/flyDetail`;
            this.jiayuanList.youli[i].from = "bingshiyin";
            this.jiayuanList.youli[i].isToDetail1 = true;
            this.jiayuanList.youli[i].detailType = "youji";
          }
          // 我的福田添加路由
          for (let i = 0; i < this.jiayuanList.futian.length; i++) {
            this.jiayuanList.futian[
              i
            ].url = `/pages/distinguish/discussionGroup`;
            this.jiayuanList.futian[i].from = "bingshiyin";
            this.jiayuanList.futian[i].isToDetail1 = true;
            this.jiayuanList.futian[i].detailType = "futian";
          }
          // 我的研修添加路由
          for (let i = 0; i < this.jiayuanList.yanxiu.length; i++) {
            this.jiayuanList.yanxiu[i].url = `/pages/training/detail`;
            this.jiayuanList.yanxiu[i].from = "bingshiyin";
            this.jiayuanList.yanxiu[i].isToYanDetail = true;
            this.jiayuanList.yanxiu[i].detailType = "yanxiu";
          }
          // 训练营添加路由
          for (let i = 0; i < this.jiayuanList.xunlian.length; i++) {
            this.jiayuanList.xunlian[i].url = `/pages/training/trainDetail`;
            this.jiayuanList.xunlian[i].from = "bingshiyin";
            this.jiayuanList.xunlian[i].isToDetail = true;
            this.jiayuanList.xunlian[i].detailType = "xunlianying";
          }

          // this.is_guanzhu = data.is_guanzhu
          // this.user = data.user
          // console.log(data, "家园");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    // 跳转家族家乡列表
    myRecord() {
      // console.log(this.user_id)
      uni.navigateTo({
        url: `/pages/detail/myRecord?id=${this.user_id}&type=${this.type}`,
      });
    },
    // 更新相册
    updateDataXiangce(value) {
      // console.log(value, 66666666);
      this.page = 1;
      this.last_page = 0;
      this.getXiangCe(value);
    },
    // 相册
    getXiangCe(time) {
      this.$http
        .userXiangce({
          user_id: this.user_id,
          time: time,
          page: this.page,
          p: 15,
        })
        .then((res) => {
          let data = res.data.list;
          // this.xiangceList = res.data.list;

          if (res.data.list.current_page == 1) {
            this.xiangceList = res.data.list;
          } else {
            this.xiangceList.data = this.xiangceList.data.concat(
              res.data.list.data
            );
          }
          this.last_page = res.data.list.last_page;
          // this.is_guanzhu = data.is_guanzhu
          // this.user = data.user
          // console.log(data, "相册");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
    // 评论
    getPingLun() {
      this.$http
        .userPingLun({ user_id: this.user_id, page: this.page })
        .then((res) => {
          let data = res.data.list;
          // this.pinglunList = res.data.list;
          if (res.data.list.current_page == 1) {
            this.pinglunList = res.data.list;
          } else {
            this.pinglunList.data = this.pinglunList.data.concat(
              res.data.list.data
            );
          }
          this.last_page = res.data.list.last_page;
          // this.is_guanzhu = data.is_guanzhu
          // this.user = data.user
          // console.log(data, "评论");
        })
        .catch((error) => {
          uni.$u.toast(error);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.ba_img1 {
  margin: 0;
  // background: url("/static/images/index.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  // padding-bottom: 40rpx;
  box-sizing: border-box;
  .header {
    position: fixed;
    z-index: 999;
    width: 100%;
    height: 120rpx;
    padding-top: 40rpx;
    .head_left {
      position: absolute;
      left: 30rpx;
      top: 80rpx;
    }

    .title {
      width: 100%;
      height: 120rpx;
      line-height: 120rpx;
      font-size: 38rpx;
      font-weight: 400;
      color: #eeeeee;
      text-align: center;
      position: fixed;
    }
    .jiahao {
      position: absolute;
      right: 30rpx;
      top: 80rpx;
      color: #eeeeee;
      image {
        width: 38rpx;
        height: 38rpx;
        color: #eeeeee;
      }
    }
  }

  // .chooseIndex {
  //   z-index: 999;
  //   top: 120rpx;
  //   position: fixed;
  // }
  .user_detail {
    padding: 0rpx 40rpx 20rpx 40rpx;
    // margin-top: 40rpx;
    .user_img {
      display: flex;
      justify-content: space-between;
      align-items: center;
      .user_img_left {
        width: 160rpx;
        height: 160rpx;
        opacity: 1;
        // overflow: hidden;
        image {
          width: 160rpx;
          height: 160rpx;
          border-radius: 50%;
        }
      }
      .user_img_right {
        width: 180rpx;
        height: 64rpx;
        background: #55b877;
        border-radius: 32rpx 32rpx 32rpx 32rpx;
        opacity: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        .btn_text {
          margin-left: 11rpx;
          font-size: 28rpx;
          color: #eeeeee;
        }
      }
      .user_img_right_false {
        width: 180rpx;
        height: 64rpx;
        background: rgba(173, 173, 173, 0.102);
        border: 1rpx solid #adadad;
        border-radius: 32rpx 32rpx 32rpx 32rpx;
        opacity: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        .btn_text_false {
          margin-left: 11rpx;
          font-size: 28rpx;
          color: #adadad;
        }
      }
      .user_img_right_border {
        width: 180rpx;
        height: 64rpx;
        background: rgba(173, 173, 173, 0.102);
        border: 1rpx solid #adadad;
        border-radius: 32rpx 32rpx 32rpx 32rpx;
        opacity: 1;
        display: flex;
        justify-content: center;
        align-items: center;
        .btn_text {
          margin-left: 11rpx;
          font-size: 28rpx;
          color: #adadad;
        }
      }
    }
    .user_name {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 32rpx;
      .user_name_left {
        width: 350rpx;
        .userName {
          width: 280rpx;
          font-size: 40rpx;
          color: #eeeeee;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
        }
        .userGrade {
          font-size: 26rpx;
          color: #eeeeee;
          margin-top: 8rpx;
        }
      }
      .user_name_right {
        display: flex;
        justify-content: center;
        align-items: center;
        .user_data {
          .user_data_top {
            text-align: center;
            color: #eeeeee;
            font-size: 32rpx;
          }
          .user_data_bot {
            text-align: center;
            color: #adadad;
            font-size: 24rpx;
            margin-top: 8rpx;
          }
        }
        .user_seg {
          width: 1rpx;
          height: 48rpx;
          background: rgba(255, 255, 255, 0.3);
          border-radius: 0rpx 0rpx 0rpx 0rpx;
          opacity: 1;
          margin: 0 24rpx;
        }
      }
    }
    .user_member {
      font-size: 26rpx;
      color: #cfa8e2;
      margin-top: 8rpx;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      width: 338rpx;
      margin-top: 8rpx;
      display: flex;
      align-items: center;
    }
    .user_text {
      font-size: 28rpx;
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      margin-top: 8rpx;
      color: #adadad;
    }
  }

  .tab_view {
    width: 100%;
    border-bottom: 1rpx solid rgba(255, 255, 255, 0.3);
  }
  .gongchuang_box {
    padding: 40rpx;
    box-sizing: border-box;
    .item_box {
      display: flex;
      align-items: center;
      color: white;
    }
    .empty_view {
      margin-top: 300rpx;
      image {
        margin: 0 auto;
        width: 410rpx;
        height: 410rpx;
      }
      view {
        font-size: 30rpx;
        color: #d8d8d8;
        text-align: center;
      }
    }
  }
  .chooseItem {
    // padding-top: 176rpx;
    // padding-top: 120rpx;

    .list_item {
      padding: 42rpx 0 0 0;
    }
    .list_home {
      padding: 42rpx 30rpx;
      .nolist_box {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 20rpx 30rpx;
        background: rgba(39, 39, 39, 0.7);
        color: white;
        border-radius: 8px 8px 8px 8px;
        margin-bottom: 40rpx;
      }
    }
  }
  .chooseItem2 {
    // padding-top: 40rpx;
  }
}
.slot-icon {
  width: 21px;
  height: 21px;
  background-color: $u-warning;
  border-radius: 100px;
  font-size: 12px;
  color: #fff;
  line-height: 21px;
  text-align: center;
}
</style>
